#include "stdafx.h"
#include <serialization/ioParamStructs.h>
#include <serialization/serialization.h>
#include <winsock/winsock_stub.h>

void ioctlsocket_stub (
    __in  std::vector<char>& in_buf,
    __out std::vector<char>& out_buf
    )
{
//RECEIVE()
    Deserialize deserialize (in_buf);
    ioctlsocket_in_inout ioctlsocketIN;
    deserialize(ioctlsocketIN);

    int ret = ioctlsocket(ioctlsocketIN.s_, ioctlsocketIN.cmd_, ioctlsocketIN.argp_);
//SEND
    ioctlsocket_out_inout ioctlsocketOUT(
        ioctlsocketIN.argp_, (ret == 0) ? 0 : WSAGetLastError());
    
    Serialize(deserialize.get_header(), ioctlsocketOUT, out_buf);
}
